#!/usr/bin/env python
import os,sys
# from celery import Celery
from flask import g
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand

# sys.path.append(os.path.dirname(sys.path[0]))
from app import create_app, db

app = create_app(os.getenv('FLASK_CONFIG') or 'default')

# #celery
# create_app = make_celery(app)
# #路由
# from app.urls import create_router
# create_router(app)


#插入脚本
manager = Manager(app)
migrate = Migrate(app, db)


def make_shell_context():
    return dict(app=app, db=db)


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    # manager.run()
    # print(app.url_map)
    app.run(port=5000)




# 初始化数据库 python manage.py db init

# 迁移命令 python manage.py db migrate

# 更新数据库变动 python manage.py db upgrade

#启动服务命令 python manage.py runserver


    
    
